<?php

$db = mysql_connect('localhost', 'revealweb', 'r3v34ls3cr3t') or die("Can't connect to db");
mysql_select_db('reveal_titles');

$query = "select * from categories order by parent_category_id,category_name";

$results = mysql_query($query);

header('Content-type: application/json');
$categories = array();

while ($result = mysql_fetch_assoc($results)) {
  $categories[] = $result;
}

echo json_encode($categories);
?>
